#pragma once
#include<assert.h>

namespace hcc
{
	template<class Iterator,class Ref,class Ptr>
	struct riterator
	{
		typedef riterator<Iterator, Ref, Ptr> self;
		Iterator _it;

		riterator(Iterator it) :_it(it) {}
		Ref operator*()
		{
			Iterator tmp(_it);
			return *(--tmp);
		}
		Ptr operator->()
		{
			return _it.operator->();
		}
		self& operator++()
		{
			--_it;
			return *this;
		}
		self& operator++(int)
		{
			self tmp(_it);
			--_it;
			return tmp;
		}
		self& operator--()
		{
			++_it;
			return *this;
		}
		self& operator--(int)
		{
			self tmp(_it);
			++_it;
			return tmp;
		}
		bool operator!=(const  self& s)
		{
			return _it != s._it;
		}
		bool operator==(const self &s)
		{
			return _it == s._it;
		}
	};
};




